package com.aiti.lulian.controller;

import com.aiti.base.core.base.controller.WebController;
import com.aiti.base.core.utils.message.Message;
import com.aiti.lulian.dto.ShowUserLogDto;
import com.aiti.lulian.entity.ShowUserLog;
import com.aiti.lulian.service.IShowUserLogService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("userLog")
public class ShowUserLogController extends WebController {
    @Autowired
    private IShowUserLogService showUserLogService;

    @ApiOperation(value = "查询列表-分页")
    @GetMapping("userLogPage")
    public Message userLogPage(ShowUserLogDto showUserLogDto) {
        try {
            Integer pageSize = showUserLogDto.getPageSize();
            Integer pageNum = showUserLogDto.getPageNum();
            Page<ShowUserLog> page = startPage(pageNum,pageSize);
            List<ShowUserLog> list=    showUserLogService.findList(page,showUserLogDto);
            return Success(getPageResult(list,pageNum,pageSize,(int)page.getTotal()));
        }catch (Exception e){
            logger.error("查询异常：===》" + e);
            return Error(e.getMessage());
        }
    }
}
